package com.sunnada.edu.business.salaryManage.dao;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Repository;

import com.sunnada.edu.system.pub.dao.BaseDaoImpl;

@Repository
public class PayrollDaoImpl extends BaseDaoImpl implements PayrollDao {

	@Override
	public int getPayrollCots(HashMap<String, String> params) {
		List list = selectList("payroll_sqlmap.getPayrollCots", params);
		if (list != null && list.size() > 0) {
			String cot = ((Map) list.get(0)).get("COT") + "";
			return Integer.valueOf(cot);
		}
		return 0;
	}

	@Override
	public List<?> findPayroll(HashMap<String, String> params) {
		return selectList("payroll_sqlmap.findPayroll", params);
	}

	@Override
	public int attendanceDelete(HashMap<String, String> params) {
		return delete("payroll_sqlmap.attendanceDelete", params);
	}

	@Override
	public int attenRecordAdd(HashMap<String, String> params) {
		return insert("payroll_sqlmap.attenRecordAdd", params);
	}

	@Override
	public int attendanceUpdate(HashMap<String, String> params) {
		return update("payroll_sqlmap.attendanceUpdate", params);
	}

	@Override
	public Map attendanceByRecId(HashMap<String, String> params) {
		List list = selectList("payroll_sqlmap.attendanceByRecId", params);
		if (list != null && list.size() > 0) {
			return (Map) list.get(0);
		}
		return null;
	}
	
	@Override
	public List<?> exportAttendance(HashMap<String, String> params) {
		return selectList("payroll_sqlmap.exportAttendance", params);
	}

	@Override
	public int payrollToAudit(HashMap<String, String> params) {
		return insert("payroll_sqlmap.payrollToAudit", params);
	}

	@Override
	public int insertPayrollApplyWorkers(List<HashMap<String, String>> list) {
		return insert("payroll_sqlmap.insertPayrollApplyWorkers", list);
	}

	@Override
	public List<?> getPayrollApplyByRecid(HashMap<String, String> params) {
		return selectList("payroll_sqlmap.getPayrollApplyByRecid", params);
	}

	@Override
	public int getPayrollApplyWorkerCots(HashMap<String, String> params) {
		List list = selectList("payroll_sqlmap.getPayrollApplyWorkerCots", params);
		if (list != null && list.size() > 0) {
			String cot = ((Map) list.get(0)).get("COT") + "";
			return Integer.valueOf(cot);
		}
		return 0;
	}

	@Override
	public List<?> findPayrollApplyWorker(HashMap<String, String> params) {
		return selectList("payroll_sqlmap.findPayrollApplyWorker", params);
	}

	@Override
	public int saveRealPay(Map<String, Object> pMap) {
		return update("payroll_sqlmap.saveRealPay", pMap);
	}

}
